import http from '@/utils/axios'
import { ReportingListParams } from '@/api/model/reportModel'
import { BasicResponseModel } from './model/basicModel'

enum Api {
  List = '/statement/dir-statement/list', // 查询报表上报列表
  Detail = '/statement/dir-statement/getByDirId', //查询报表详情
  Summer = '/statement/dir-statement/summer', // 报表汇总
  Upload = '/statement/dir-statement/uploadStatement', //上传目录报表
  Delete = '/statement/dir-statement/delete' // 删除报表文件
}

/**
 * 查询报表上报列表
 * @param params
 */
export function getReportingList(params: ReportingListParams) {
  return http.request<BasicResponseModel>(
    {
      url: Api.List,
      method: 'GET',
      params
    },
    {
      isTransformRequestResult: false
    }
  )
}

/**
 * 查询报表详情
 * @param params
 */
export function getReportingDetail(params: { dirId: string; dirStatementId: string }) {
  return http.request(
    {
      url: Api.Detail,
      method: 'GET',
      params
    },
    {
      isShowMessage: false
    }
  )
}

/**
 * 删除报表文件
 * @param dirStatementId
 */
export function deleteReportingFile(dirStatementId: string) {
  return http.request({
    url: Api.Delete,
    method: 'GET',
    params: { dirStatementId }
  })
}

/**
 * 报表汇总
 * @param dirId
 */
export function reportingSummer(dirId: string) {
  return http.request({
    url: Api.Summer,
    method: 'GET',
    params: { dirId }
  })
}
